package com.excesys.exsecs.scada.entity;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 组态、设备关联表
 *
 * @author lxc
 * @date 2024-05-17 11:58:34
 */
@Data
@TableName(value = "scada_device", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "组态、设备关联表")
public class ScadaDevice extends Model<ScadaDevice> {

 
	/**
	* id
	*/
    @TableId(type = IdType.AUTO)
    @Schema(description="id")
    private Integer id;

	/**
	* 组态id
	*/
    @Schema(description="组态id")
    private Long scadaId;

	/**
	* 设备id
	*/
    @Schema(description="设备id")
    private String deviceId;

	/**
	 * 设备ids
	 */
	@Schema(description="设备ids")
	@TableField(exist = false)
	private List<String> deviceIds;

	/**
	 * 设备通道标识
	 */
	@Schema(description = "设备通道标识")
	@TableField(exist = false)
	private Integer[] models;

	/**
	 * 设备属性
	 */
	@Schema(description="设备id")
	@TableField(typeHandler = FastjsonTypeHandler.class)
	private JSONObject deviceModel;

	/**
	 * 创建人
	 */
	@TableField(fill = FieldFill.INSERT)
	@Schema(description="创建人")
	private String createBy;

	/**
	 * 创建时间
	 */
	@TableField(fill = FieldFill.INSERT)
	@Schema(description="创建时间")
	private LocalDateTime createTime;

	/**
	 * 更新人
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	@Schema(description="更新人")
	private String updateBy;

	/**
	 * 更新时间
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	@Schema(description="更新时间")
	private LocalDateTime updateTime;
}